<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>日期特效</title>
</head>
<body>
    <div id="date">
        <p id="nowDate">

        </p>
        <p id="day">

        </p>
    </div>
    <script>
        var nowDate = document.getElementById('nowDate');
        var day = document.getElementById('day');
        setInterval(getTime,10)
        nowDate.innerHTML = '2024年8月13日';
        function getTime(){
            var time = new Date();
            var h = time.getHours();
            h = h < 10 ? '0'+ h : h;
            var m = time.getMinutes();
            m = m < 10 ? '0'+ m : m
            var s = time.getSeconds();
            s = s < 10 ? '0'+ s : s
            nowDate.innerHTML = h + ':' + m + ':' + s;
            // return h + ':' + m + ':' + s
        }        
    </script>
</body>
</html>